# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-keylogger
_pkgname=keylogger
pkgver=2.7.3
pkgrel=11
pkgdesc='Simple keystroke logger.'
groups=('blackarch' 'blackarch-keylogger')
arch=('any')
url='https://github.com/GiacomoLaw/Keylogger'
license=('MIT')
depends=('python' 'python-six' 'python-xlib')
makedepends=('python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('93bdad48b8a20a4c968d9bcaf03cdcd8654efc2cb18b445b025c7ae2afbffd8164a02610f064cb35a4710b7a2d7a395314ac2a5ff793af4b088bbd95e08fe8f5')

build() {
  cd "$_pkgname-$pkgver"

  touch CHANGES.md
  sed 's|xlib||g' -i setup.py # on new release, try to remove

  python setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  # 'keylogger' for sure is a conflicting name so let's rename it here :)
  mv "$pkgdir/usr/bin/keylogger" "$pkgdir/usr/bin/$pkgname"
}

